package com.windbell.rest; 

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.ImportResource;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.windbell.rest.security.AuthorizationInterceptor;
import com.windbell.rest.security.CurrentUserMethodArgumentResolver;

@SpringBootApplication
@ImportResource("classpath:ApplicationContext.xml")
@EnableAspectJAutoProxy
public class Application extends WebMvcConfigurerAdapter{

    @Autowired
    private AuthorizationInterceptor authorizationInterceptor;

    @Autowired
    private CurrentUserMethodArgumentResolver currentUserMethodArgumentResolver;

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    // @Override 
    // public void addInterceptors(InterceptorRegistry registry) {
    //     registry.addInterceptor(authorizationInterceptor);
    //  }

    // @Override
    // public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
    //     argumentResolvers.add(currentUserMethodArgumentResolver);
    // }
    
}
